SerialListener

interface SerialListener

Interface for receiving asynchronous events and data from a serial port connected to the RevelDigital player.

This listener allows applications to react to various states of a serial communication channel, such as when the port is ready for communication, when new data is received, or when the port connection is stopped.

Implementations of this interface can be registered with a component managing serial port interactions (e.g., using an addSerialListener(SerialListener listener, int port) method on a serial port manager) to process incoming data or respond to port status changes.

Typical use cases include:

  • Receiving data from external hardware (sensors, payment terminals, control systems).
  • Monitoring the status of serial connections.
  • Implementing custom serial communication protocols.

Functions

Link copied to clipboard
abstract fun onDataReceived(data: Array<Byte>, port: Int)
Called when new data is received from the specified serial port.
Link copied to clipboard
abstract fun onReady()
Called when the serial port has been successfully opened, configured, and is ready for communication.
Link copied to clipboard
abstract fun onStopped()
Called when the serial port has been stopped or closed.